const url = require('url')

const data = 'http://beiysd.top?name=张三&age=21';

console.log(url.parse(data))
console.log(url.parse(data, true))
const urlQueryObj = url.parse(data, true)
console.log(urlQueryObj.query)
console.log(urlQueryObj.query.name)